<!--
 * @Author: 涵崽
 * @Date: 2023-12-07 13:44:03
 * @email: 1045654@qq.com
 * @gitee: https://gitee.com/han-zai
 * @LastEditors: 涵崽
 * @LastEditTime: 2023-12-07 13:44:28
 * @Description: 微信：1045654
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./style.css" />
  </head>
  <body>
    <div class="container">
      <div class="wraper">
        <div class="item">
          <div class="left"></div>
          <div class="right">主题部分</div>
        </div>
        <div class="item active">
          <div class="left"></div>
          <div class="right">主题部分</div>
        </div>
        <div class="item">
          <div class="left"></div>
          <div class="right">主题部分</div>
        </div>
        <div class="item">
          <div class="left"></div>
          <div class="right">主题部分</div>
        </div>
      </div>
    </div>

    <script>
      const items = document.querySelectorAll(".item");

      items.forEach(item => {
        item.addEventListener("mouseenter", () => {
          items.forEach(dom => {
            if (dom !== item) {
              dom.className = "item";
            }
          });

          item.classList.add("active");
        });
      });
    </script>
  </body>
</html>
